package cn.edu.nju.software.zp13.client.assignment9UsingJAXB.assignment3Refactoring.bean;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;

import cn.edu.nju.software.zp13.client.assignment3.xmlNodeEntity.util.Gender;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "personInfo")
public class Profile {
	@XmlElement(namespace = "http://www.nju.edu.cn/schema")
	private String name;
	@XmlElement(namespace = "http://www.nju.edu.cn/schema")
	private Gender gender;
	@XmlElement(namespace = "http://www.nju.edu.cn/schema")
	@XmlJavaTypeAdapter(LocalDateToStringAdapter.class)
	private LocalDate birthday;
	@XmlElement(namespace = "http://www.nju.edu.cn/schema")
	private Department department;

	public Profile() {
	}

	public Profile(String name, Gender gender, LocalDate birthday, Department department) {
		super();
		this.name = name;
		this.gender = gender;
		this.birthday = birthday;
		this.department = department;
	}

	public Gender getGender() {
		return gender;
	}

	public String genderToString() {
		return this.gender.toString();
	}

	public String birthdayToString() {
		return birthday.format(DateTimeFormatter.ISO_DATE);
	}

	public void setGender(Gender gender) {
		this.gender = gender;
	}

	public LocalDate getBirthday() {
		return birthday;
	}

	public void setBirthday(LocalDate date) {
		this.birthday = date;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Department getDepartment() {
		return department;
	}

	public void setDepartment(Department department) {
		this.department = department;
	}

}
